package com.fancy.learncenter.ui.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.facebook.drawee.view.SimpleDraweeView;
import com.fancy.learncenter.R;
import com.fancy.learncenter.bean.SchoolDataBean;
import com.fancy.learncenter.ui.activity.CourseDetailActivity;
import com.fancy.learncenter.ui.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.ui.adapter.base.CustomViewHold;

import java.util.List;

/**
 * Created by Hyy on 2016/12/26.
 */

public class FragmentSchoolAdapter extends CommonRecycleViewAdapter<SchoolDataBean.ResultBean> {
    Context mContext;

    public FragmentSchoolAdapter(Context mContext, List<SchoolDataBean.ResultBean> itemDatas) {
        super(mContext, R.layout.fragment_school_item, itemDatas);
        this.mContext = mContext;
    }

    @Override
    public void bindView(CustomViewHold customViewHold, final SchoolDataBean.ResultBean item, int position) {
        SimpleDraweeView simpleDraweeView = (SimpleDraweeView) customViewHold.getRoorView();
        simpleDraweeView.setImageURI(item.getLessonCategoryImgurl());

        customViewHold.getRoorView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, CourseDetailActivity.class);
                intent.putExtra("type", item.getLessonType());
                mContext.startActivity(intent);
            }
        });

    }
}
